package com.tpp.order.client;

import com.tpp.comm.client.OrderClient;
import com.tpp.comm.pojo.TpOrder;
import com.tpp.order.service.OrderService;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class OrderClientImpl implements OrderClient {

    @Resource
    private OrderService orderService;

    @Override
    public TpOrder findByOrderNo(String orderNo) {
        return orderService.searchOrder(orderNo);
    }

    @Override
    public void updateOrderStatus(String orderNo, int orderType) {
        TpOrder tpOrder = orderService.searchOrder(orderNo);
        if(tpOrder!=null)
            orderService.updateOrderStatus(orderNo,orderType);
    }
}
